import moment from 'moment'
<template>
  <a-card :bordered="false">
    <detail-list title="导师信息">
      <detail-list-item term="导师编号">{{ teacherInfo.dsbh }} <a @click="toInfo" v-if="teacherInfo.shbs == 0">导师原始信息</a>
      </detail-list-item>
      <detail-list-item term="院系名称">{{ teacherInfo.dsssyxmc }}&nbsp;</detail-list-item>
      <detail-list-item term="姓名">{{ teacherInfo.xm }}&nbsp;</detail-list-item>
      <detail-list-item term="性别">{{ teacherInfo.xbmc }}&nbsp;</detail-list-item>
      <detail-list-item term="出生日期">{{ teacherInfo.csrq && teacherInfo.csrq.format('YYYY-MM-DD') }}&nbsp;
      </detail-list-item>
      <detail-list-item term="职称">{{ teacherInfo.zcmc }}&nbsp;</detail-list-item>
      <detail-list-item term="最后学历">{{ teacherInfo.zhxlmc }}&nbsp;</detail-list-item>
      <detail-list-item term="最后学位">{{ teacherInfo.zhxwmc }}&emsp;</detail-list-item>
      <detail-list-item term="毕业院校或机构">{{ teacherInfo.byyxmc }}&nbsp;</detail-list-item>
      <detail-list-item term="毕业年月">{{ teacherInfo.byny && teacherInfo.byny.format('YYYY-MM-DD') }}&nbsp;</detail-list-item>
      <detail-list-item term="身份证号">{{ teacherInfo.sfzh }}&nbsp;</detail-list-item>
      <detail-list-item term="导师类别">{{ teacherInfo.dslbmc }}&nbsp;</detail-list-item>
      <detail-list-item term="批准年月">{{ teacherInfo.rdpzny}}&nbsp;</detail-list-item>
      <!-- <detail-list-item term="现从事专业">&nbsp;</detail-list-item> -->
      <detail-list-item term="是否在岗">{{ teacherInfo.dssfzgmc }}&nbsp;</detail-list-item>
      <detail-list-item term="电子邮箱">{{ teacherInfo.dzyx }}&nbsp;</detail-list-item>
      <detail-list-item term="手机号码">{{ teacherInfo.sjhm }}&nbsp;</detail-list-item>
      <detail-list-item term="办公电话">{{ teacherInfo.bgdh }}&nbsp;</detail-list-item>
      <detail-list-item term="住宅电话">{{ teacherInfo.zzdh }}&nbsp;</detail-list-item>
    </detail-list>
    <a-row style="margin:10px 0;font-size: 16px">指导专业及研究方向：</a-row>
    <a-row>
      <span style="color: #000">指导专业：</span>{{ teacherInfo.zdzymc }} <br/>
      <span style="color: #000">研究方向：</span>{{ teacherInfo.yjfxmc }}
    </a-row>
    <a-row style="margin:10px 0;color: #000">导师简介：</a-row>
    <a-row>{{ teacherInfo.dsjj }}</a-row>
    <a-form :form="form">
      <a-row>
        <a-col :md="8" :sm="24">
          <a-form-item
            label="审核结果"
            :labelCol="{span: 7,offset: 1}"
            :wrapperCol="{span: 15, offset: 1}"
          >
            <a-select v-decorator="['shzt',
              {
                rules: [{ required: true, message: '请选择审核结果!' }],
              }]">
              <a-select-option v-for="i in TYPE0133" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
            </a-select>
          </a-form-item>
        </a-col>
        <a-col :md="16" :sm="24">
          <a-form-item
            label="审核说明"
            :labelCol="{span: 7,offset: 1}"
            :wrapperCol="{span: 15, offset: 1}"
          >
            <a-input type="textarea" v-decorator="['shsm',
              {
                rules: [{ required: true, message: '请填写审核说明!' }],
              }]" :autosize="{ minRows: 4, maxRows: 6 }"/>
          </a-form-item>
        </a-col>
      </a-row>
      <div class="ant-pro-footer-toolbar">
        <a-button style="float: right;margin-top: 10px;" @click="submit" :loading="loadingBtn" type="primary">提交</a-button>
        <a-button style="float: right;margin-top: 10px; margin-right: 20px;" @click="back">返回</a-button>
      </div>
    </a-form>
  </a-card>
</template>

<script>

  import DetailList from '~/tool/DetailList'
import { mapState } from 'vuex'
const DetailListItem = DetailList.Item

  export default {
    data () {
      return {
        loadingBtn: false,
        teacherInfo: {}
      }
    },
    beforeCreate () {
      this.form = this.$form.createForm(this)
    },
    computed: {
      ...mapState({
        TYPE0133: state => state.app['TYPE0133']
      })
    },
    components: {
      DetailList,
      DetailListItem
    },
    created () {
      this.$store.dispatch('app/setDictionary', 'TYPE0133')
      this.$api.teacher.teacherCheckInfo({dsbh: this.$route.params.dsbh}).then(res => {
        this.teacherInfo = res.data || {}
      })
    },
    methods: {
      submit () {
        this.form.validateFields((err, values) => {
          if (err) {
            return
          }
          this.loadingBtn = true
          this.$api.teacher.teacherCheck(Object.assign(values, {dsbhs: this.teacherInfo.dsbh})).then(res => {
            this.$message.success('操作成功')
            this.$router.back()
          }).finally(() => {
            this.loadingBtn = false
          })
        })
      },
      back () {
        this.$router.back()
      },
      toInfo () {
        this.$router.push(`/teacher/info/${this.teacherInfo.dsbh}`)
      }
    }
}
</script>

<style>

</style>
